<%@page import="org.jeecgframework.web.util.StaticValue"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<div class="easyui-layout" fit="true">
	<div region="center" style="padding:1px;">
		<t:datagrid name="installRecordFifferList" onLoadSuccess="colorStyle" sortName="sn" fitColumns="false" title="未处理的数据差异如下" 
			actionUrl="zyInstallRecordController.do?differDatagrid" idField="id" fit="true" queryMode="group">
		   <t:dgCol title="主键"			field="id"		hidden="true"  queryMode="single"  width="120"/>
		   <t:dgCol title="版本号"		field="version"				queryMode="single"	query="false"  width="60"/>
		   <t:dgCol title="编号"			field="no"	 queryMode="single"	query="false"  width="80"/>
		   <t:dgCol title="上传日期"		field="importDate"	 formatter="yyyy-MM-dd"		queryMode="single"	query="false"  width="80"/>
		   <t:dgCol title="序列号"		field="sn"			queryMode="single"	query="false"  width="85"/>
		   <t:dgCol title="机型"			field="dpModel"		queryMode="single"	query="false"  width="80"/>
		   <t:dgCol title="实际发货日期"	field="actualSendDate" formatter="yyyy-MM-dd"	queryMode="single"	query="false"  width="85"/>
		   <t:dgCol title="所属经销商"	field="belongDealer"			queryMode="single"	query="false"  width="85"/>
		   <t:dgCol title="影院名称"		field="cnCustomerName"			queryMode="single"	query="false"  width="80"/>
		   <t:dgCol title="影院地址"		field="cnAddress"				queryMode="single"	query="false"  width="150"/>
		   <t:dgCol title="联系人"		field="contacter"				queryMode="single"	query="false"  width="60"/>
		   <t:dgCol title="电话"			field="telNo"					queryMode="single"	query="false"  width="85"/>
		   <t:dgCol title="影厅"			field="house"				queryMode="single"	query="false"  width="85"/>
		   <t:dgCol title="安装日期"		field="installedDate"	formatter="yyyy-MM-dd"	queryMode="single"	query="false"  width="80"/>
		   <t:dgCol title="保修期(年)"	field="warrantyPeriod"				queryMode="single"	query="false"  width="70"/>
		   <t:dgCol title="变更类型"		field="type" queryMode="single"	query="false" dictionary="<%=StaticValue.DIC_FILE_SET_TYPE %>" width="60"/>
		   <t:dgCol title="处理状态"		field="status"				queryMode="single"	query="false" dictionary="<%=StaticValue.DIC_FILE_SET_STATUS %>" width="60"/>
		   
		   <t:dgCol title="编号"			field="noColor"				hidden="true" width="120"/>
		   <t:dgCol title="机型"			field="dpModelColor"		hidden="true" width="120"/>
		   <t:dgCol title="实际发货日期"	field="actualSendDateColor"	hidden="true" width="120"/>
		   <t:dgCol title="所属经销商"	field="belongDealerColor"	hidden="true" width="120"/>
		   <t:dgCol title="影院名称"		field="cnCustomerNameColor" hidden="true" width="120"/>
		   <t:dgCol title="影院地址"		field="cnAddressColor"		hidden="true" width="120"/>
		   <t:dgCol title="影厅"			field="houseColor"			hidden="true" width="120"/>
		   <t:dgCol title="联系人"		field="contacterColor"		hidden="true" width="120"/>
		   <t:dgCol title="电话"			field="telNoColor"			hidden="true" width="120"/>
		   <t:dgCol title="安装日期"		field="installedDateColor"	hidden="true" width="120"/>
		   <t:dgCol title="保修期"		field="warrantyPeriodColor" hidden="true" width="120"/>
		   <t:dgCol title="标识"			field="formFlag"			hidden="true" width="120"/>
		   
		   <t:dgCol title="操作" field="opt" width="45"/>
  		   <t:dgFunOpt title="处理" funname="handle(id)" exp="formFlag#eq#2" />
  		   <t:dgToolBar title="导入" operationCode="installRecordFifferAdd" icon="icon-put" funname="importExcel" />
<%--			<t:dgToolBar title="##定时导入安装记录-仅供测试用##" icon="icon-add" url="zyInstallRecordController.do?runTimeTask" funname="runTimeTask" />--%>
		</t:datagrid>
	</div>
</div>
<script>
function importExcel(){
	createdetailwindow('安装记录导入', 'uploadInstallRecordController.do?uploadFile',470,150);
}
function handle(id){
	$.dialog.confirm("确认处理？",function(r){
		if(r){
			$.ajax({
				url : "zyInstallRecordController.do?doSetStatus",
				data : {
					"id" : id
					},
				cache : false,
				dataType : 'json',
				type : 'POST',
				success : function(data){
					if(data.success){
						reloadTable();
					}else{
						tip(data.msg);
					}
				}
			});
		}
	});
}
function colorStyle(){
	changeTergatColumnColor('noColor','red','installRecordFifferList','no','red');
	changeTergatColumnColor('dpModelColor','red','installRecordFifferList','dpModel','red');
	changeTergatColumnColor('actualSendDateColor','red','installRecordFifferList','actualSendDate','red');
	changeTergatColumnColor('belongDealerColor','red','installRecordFifferList','belongDealer','red');
	changeTergatColumnColor('cnCustomerNameColor','red','installRecordFifferList','cnCustomerName','red');
	changeTergatColumnColor('cnAddressColor','red','installRecordFifferList','cnAddress','red');
	changeTergatColumnColor('contacterColor','red','installRecordFifferList','contacter','red');
	changeTergatColumnColor('telNoColor','red','installRecordFifferList','telNo','red');
	changeTergatColumnColor('houseColor','red','installRecordFifferList','house','red');
	changeTergatColumnColor('installedDateColor','red','installRecordFifferList','installedDate','red');
	changeTergatColumnColor('warrantyPeriodColor','red','installRecordFifferList','warrantyPeriod','red');
}
/**
*tergetColumn 对比目标列
*value 对比值
*datagrId datagrId
*changeColumn 改变列
*color 改变颜色 
*/
function changeTergatColumnColor(tergetColumn,value,datagrId,changeColumn,color){
	var rows = $("#"+datagrId+"").datagrid('getRows');//获取所有的数据行
	for (var i = 0; i < rows.length; i++) {
		var target = rows[i][''+tergetColumn+''];
		if(target == value){
        	$("td[field='"+changeColumn+"']").parent(".datagrid-row").eq(i).children("td[field='"+changeColumn+"']").css("color",color);
        }
	}
}
function runTimeTask(title,url){
	$.post(url,function(){
		tip("执行完毕");
	});
}
</script>
